package main

import (
	"fmt"
	"strings"
)

//使用map
func main() {
	cityMap := make(map[string]string)

	//添加
	cityMap["China"] = "Bj"
	cityMap["Japan"] = "Tokyo"
	cityMap["USA"] = "NowYork"

	//遍历
	printMap(cityMap)

	delete(cityMap, "no")
	changeValue(cityMap)
	printMap(cityMap)

}

//printMap 遍历，map是引用传递
func printMap(cityMap map[string]string) {
	fmt.Println("---------")
	for k, value := range cityMap {
		fmt.Println("key=", k, " value=", value)
	}
}
func changeValue(cityMap map[string]string) {
	cityMap["USA"] = strings.Repeat(cityMap["USA"], 2)
}
